

<div class="inner form-login" >
	<div id="home">
		<div class="main">
			<div class="container-input">
				<form action="/siteadmin/channel.php?p=add" method="POST" enctype="multipart/form-data">
					

				  <fieldset>
<?php
	
	if(!empty($_POST)) {

		addChannel($_POST);

	}
?>

					<legend>Add Channel</legend>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Name of channel</label>
							<div class="controls">
								<input type="text" name="name" id="inputName" placeholder="Name" value="<?php echo !empty($_POST['name']) ? $_POST['name'] : "" ;?>">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Type Channel </label>
							<div class="controls">
								<select name="channel_type_id" style="height:30px; margin:12px">
								<?php
								global $db;
								$rows = listTypeChannels('id desc');
					
								while ($record= $db->fetch_array($rows)) {
									echo "<option value='".$record['id']."'>".$record['name']."</option>";
								}
								?>
								</select>
								
							</div>
							
							<div class="controls">
								<a href="/siteadmin/channel.php?p=add_type_channel" style="margin:0 20px;" target="_blank">Add channel type  </a>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Date</label>
							
							<div class="controls">
								<input type="text" name="date_watch" id="inputName" placeholder="<?php echo date("Y-m-d");?>" value="<?php echo !empty($_POST['date_watch']) ? $_POST['date_watch'] : date("Y-m-d") ;?>">
								
							</div>
							
								
							
						</div>						
						<div class="control-group">
							<label class="control-label" for="inputEmail">Hour</label>
							
							<div class="controls">
								<input type="number" name="hour" id="inputName" placeholder="00" value="<?php echo !empty($_POST['hour']) ? $_POST['hour'] : "00" ;?>">
								
							</div>
							
								
							
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Minutes</label>
							<div class="controls">
								<input type="number" name="minutes" id="inputName" placeholder="00" value="<?php echo !empty($_POST['minutes']) ? $_POST['minutes'] : "00" ;?>">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Category </label>
							<div class="controls">
								<select name="category_id" style="height:30px; margin:12px">
								<?php
								global $db;
								$rows = listCategory('created desc');
					
								while ($record= $db->fetch_array($rows)) {
									echo "<option value='".$record['id']."'>".$record['name']."</option>";
								}
								?>
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Type </label>
							<div class="controls">
								<select name="icon_type" style="height:30px; margin:12px">
								<?php
								global $db;
								$rows = listType();
					
								while ($record= $db->fetch_array($rows)) {
									echo "<option value='".$record['image']."'>".$record['name']."</option>";
								}
								?>
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Icon url</label>
							<div class="controls">
								<input type="file" name="file" id="inputEmail" placeholder="Icon url" value="<?php echo !empty($_POST['url_icon']) ? $_POST['url_icon'] : "" ;?>">
							</div>
						</div>
						<br>
						<div id="embled_code_pull">
							<div class="control-group">
								<label class="control-label" for="inputEmail">Embled code #1</label>
								<div class="controls">
									<textarea type="text"  name="embled_code[0]" id="inputIcon" value="" placeholder="Embled code" style="margin:12px;" rows="10" cols="50"></textarea>
									
								</div>
							</div>
							
						</div>
						<a href="javascript:void(0)" id="add_embled_code" style="margin:0 20px;">Add Embled Code  </a>
						<br>
						<hr>
						
						
						<div class="control-label">
							&nbsp;
						</div>
						<div class="controls">
							<button type="submit" class="btn">Submit</button>
						</div>
				  </fieldset>
				</form>
			</div>
		</div>
	</div>
</div>


<script>
var clicked = 1;
$().ready(function(e){
	$('#add_embled_code').live('click',function(e){
		clicked++;
		_clicked = clicked-1;
		var html = '<div class="control-group">'+
		'<label class="control-label" for="inputEmail">Embled code #'+clicked+'</label>'+
			'<div class="controls">'+
				'<textarea type="text"  name="embled_code['+_clicked+']" id="inputIcon" value="" placeholder="Embled code" style="margin:12px;" rows="10" cols="50"></textarea>'+
			'</div>'+
		'</div>';
		$('#embled_code_pull').append(html);
	});
	
});
</script>




